﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Chowpoo.Sql;
using CourseSystem.Core.Entities;

namespace CourseSystem.Core.SqlServerDAL
{
    public class CommonResourcesDAL : CommonDal<CommonResourcesInfo>
    {
        public CommonResourcesDAL()
            : base(Settings.ConnectionName)
        {
        }

        public CommonResourcesDAL(string mConnectionStringName)
            : base(mConnectionStringName)
        {
        }

        public bool UpdateHit(int id)
        {
            var dc = DataContext<CommonResourcesInfo>.CreateContext(Settings.ConnectionName);
            return dc.ExecuteCommand("update [CommonResources] set hits=hits+1 where id=" + id) > 0;
        }
    }
}
